#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=1.5e5+5;
int n,m,q;
int a[N];
ll s,ans;
pair<int,int> qq[N];
int be,ed;
int main(){
    freopen("clear.in","r",stdin);
    freopen("clear.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m>>q;
    for(int i=1;i<=n;++i)cin>>a[i];
    while(q--){
        int l,r;
        cin>>l>>r;
        ans=s=0;
        ed=0;be=1;
        for(int i=l;i<=r;++i){
            while(be<=ed&&qq[be].first<i-m+1){
                s-=qq[be].second;
                ++be;
            }
            while(be<=ed&&s>a[i]){
                if(s-qq[be].second>=a[i]){
                    s-=qq[be].second;
                    ++be;
                }
                else{
                    qq[be].second-=s-a[i];
                    s=a[i];
                }
            }
            if(s==a[i])continue;
            qq[++ed]={i,a[i]-s};
            ans+=a[i]-s;
            s=a[i];
        }
        cout<<ans<<'\n';
    }
    return 0;
}
